// "Copyright [2021] <Copyright Shengkai Lin>"

package cluster.networks;

import cluster.compound_modules.*;
import cluster.simple_modules.*;
import cluster.protocols.*;
import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;

network PingpongNetwork {
    submodules:
        test_app[2] : TestApp {
            parameters:
                localIdx = index;
        }
        configurator: Ipv4NetworkConfigurator {
            parameters:
                @display("p=100,100;is=s");
                dumpAddresses = true;
                dumpTopology = true;
                dumpLinks = true;
                addSubnetRoutes = false;
                addDefaultRoutes = false;
                optimizeRoutes = false;
                config = xml("<config><interface hosts='**' address='192.168.x.x' netmask='255.255.0.0'/></config>");
        }
        nic[2] : <default("EthernetNicSimple")> like INic{
            parameters:
                my_index = index;
                my_global_index = index;
        }
    connections allowunconnected:
        test_app[0].socket_port <--> nic[0].gpu_port;
        nic[0].out_port <-->Fiber<--> nic[1].out_port;
        nic[1].gpu_port <--> test_app[1].socket_port;
}